
local cluster_iv="judgeXyear "

local instrument="stringency_n100_loo"
local fe="districtXquarter"

macro define controls="noprior joint ad_damnum ageatcase age_sq age_cub fem1 fem1_miss neigh_pov_rate_5yr nbrhd_med_rent_5yr neigh_pov_rate_5yr_miss nbrhd_med_rent_5yr_miss"

use unique_id evicted $controls `fe' `instrument' `cluster_iv' using "$build/iv_fin_strain.dta", clear

**************
*First stage *
**************
*Save output to make final tables
gen spec=""
gen beta_est=.	
gen beta_se=.	
gen n_obs_mean=.
gen beta_name="Stringency instrument"

eststo firststage1: areg evicted `instrument', r cluster(`cluster_iv') a(`fe')
	replace beta_est=_b[`instrument']  in 1
	replace beta_se=_se[`instrument']  in 1
	replace n_obs=e(N) in 1
	replace spec="First stage without controls" in 1
	
eststo firststage2: areg evicted `instrument' $controls, r cluster(`cluster_iv') a(`fe')
	replace beta_est=_b[`instrument']  in 2
	replace beta_se=_se[`instrument']  in 2
	replace n_obs=e(N) in 2
	replace spec="First stage with controls" in 2

keep beta_* n_obs* spec*
keep if _n<=2
export delimited using "${Inputs}/Cook_experian_fs.csv", replace
